package com.qingke.beSuper2.pojo;

public class Answer {

	private long id;
	private String value;
	private boolean best;
	private Player replier;
	private Question question;
	
	public Answer() {
	}
	
	public Answer(long id, String value, boolean isBest, Player replier, Question question) {
		this.id = id;
		this.value = value;
		this.best = isBest;
		this.replier = replier;
		this.question = question;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public boolean isBest() {
		return best;
	}

	public void setBest(boolean best) {
		this.best = best;
	}

	public Player getReplier() {
		return replier;
	}

	public void setReplier(Player replier) {
		this.replier = replier;
	}

	public Question getQuestion() {
		return question;
	}

	public void setQuestion(Question question) {
		this.question = question;
	}

	public boolean equals(Object obj) {
		if (!(obj instanceof Answer)) {
			return false;
		}
		Answer answer = (Answer)obj;
		return this.id == answer.getId();
	}
	
	public int hashCode() {
		String str = id + "";
		return str.hashCode();
	}
	
	public String toString() {
		String template = "%s. %s [QID: %s] [%s]";
		return String.format(template, id, value, question.getId(), replier.getName());
	}
	
}
